<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>插件开发之参数配置</title>
    <meta name="description" content="我们继续以之前讲解的hello插件为基础，现在为其增加参数配置选项，并且指定一个独立的脚本文件中进行开发，这样我们就可以写一些更复杂的插件    -- 定义一个名叫hello的插件任务    task("hello")        -- 设置类型为插件        set_category("plugin")...">

    
    <meta name="keywords" content="xmake,插件,菜单选项,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2016/06/09/plugin-arguments/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>插件开发之参数配置</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2016-06-09
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#%E6%8F%92%E4%BB%B6" title="Tag: 插件" rel="tag">插件</a-->
        <a href="/cn/tag/#插件" title="Tag: 插件" rel="tag">插件</a>&nbsp;
    
        <!--a href="/tag/#%E8%8F%9C%E5%8D%95%E9%80%89%E9%A1%B9" title="Tag: 菜单选项" rel="tag">菜单选项</a-->
        <a href="/cn/tag/#菜单选项" title="Tag: 菜单选项" rel="tag">菜单选项</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>我们继续以之前讲解的hello插件为基础，现在为其增加参数配置选项，并且指定一个独立的脚本文件中进行开发，这样我们就可以写一些更复杂的插件</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code>    <span class="c1">-- 定义一个名叫hello的插件任务</span>
    <span class="n">task</span><span class="p">(</span><span class="s2">"hello"</span><span class="p">)</span>

        <span class="c1">-- 设置类型为插件</span>
        <span class="n">set_category</span><span class="p">(</span><span class="s2">"plugin"</span><span class="p">)</span>

        <span class="c1">-- 插件运行的入口，这里指定main，说明从当前插件目录的main.lua脚本中加载插件入口</span>
        <span class="n">on_run</span><span class="p">(</span><span class="s2">"main"</span><span class="p">)</span>

        <span class="c1">-- 设置插件的命令行选项，这里没有任何参数选项，仅仅显示插件描述</span>
        <span class="n">set_menu</span><span class="p">({</span>
                        <span class="c1">-- usage</span>
                        <span class="n">usage</span> <span class="o">=</span> <span class="s2">"xmake hello [options]"</span>

                        <span class="c1">-- description</span>
                    <span class="p">,</span>   <span class="n">description</span> <span class="o">=</span> <span class="s2">"Hello xmake!"</span>

                        <span class="c1">-- 定义两个参数选项</span>
                        <span class="c1">-- xmake hello --output="xxx" 指定输出的内容</span>
                        <span class="c1">-- xmake hello -v 显示插件版本</span>
                    <span class="p">,</span>   <span class="n">options</span> <span class="o">=</span> 
                        <span class="p">{</span>
                            <span class="c1">-- 第一个值设置简写：xmake hello -o xxx</span>
                            <span class="c1">-- 第二个值设置全称：xmake hello --output=xxx</span>
                            <span class="c1">-- 第三个值设置类型：kv是键值对，k是仅有key没有值(-v --version)，v是值类型没有key</span>
                            <span class="c1">-- 第四个值指定参数描述信息</span>
                            <span class="p">{</span><span class="s1">'o'</span><span class="p">,</span> <span class="s2">"output"</span><span class="p">,</span>     <span class="s2">"kv"</span><span class="p">,</span> <span class="kc">nil</span><span class="p">,</span>      <span class="s2">"Set the output content."</span>  <span class="p">}</span>
                        <span class="p">,</span>   <span class="p">{</span><span class="s1">'v'</span><span class="p">,</span> <span class="s2">"version"</span><span class="p">,</span>    <span class="s2">"k"</span><span class="p">,</span>  <span class="s2">"1.0"</span><span class="p">,</span>    <span class="s2">"Show the version."</span>        <span class="p">}</span>
                        <span class="p">}</span>
                    <span class="p">})</span> 
</code></pre>
</div>

<p>这个插件的文件结构如下：</p>

<div class="highlighter-rouge"><pre class="highlight"><code>    hello
     - xmake.lua
     - main.lua
</code></pre>
</div>

<p>xmake.lua为插件的描述文件，指定一些描述信息，main.lua为插件运行入口，代码如下：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code>    <span class="c1">-- 导入选项模块</span>
    <span class="n">import</span><span class="p">(</span><span class="s2">"core.base.option"</span><span class="p">)</span>

    <span class="c1">-- main.lua入口函数</span>
    <span class="k">function</span> <span class="nf">main</span><span class="p">()</span>
     
        <span class="c1">-- 显示版本？</span>
        <span class="k">if</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">)</span> <span class="k">then</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">"version: %s"</span><span class="p">,</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">))</span>
        <span class="k">else</span>
            <span class="c1">-- 显示内容</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">"hello %s!"</span><span class="p">,</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"output"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"xmake"</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>到此一个稍微高级些插件就完成了，我们只需要执行：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>    xmake hello --version
    xmake hello -v
</code></pre>
</div>

<p>来显示版本，执行：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>    xmake hello -o xxx
    xmake hello --output<span class="o">=</span>xxx
</code></pre>
</div>

<p>来显示内容，或者执行：</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code>    xmake hello -h
    xmake hello --help
</code></pre>
</div>

<p>来显示菜单，这个选项是内置的，不需要自定义</p>

<p>其中，我们用到了<a href="/cn/2016/06/09/api-import/">import</a>这个api，这个api主要用于导入一些扩展的类库，实现一些高级的功能</p>

<p>并且还可以导入一些自定义的模块，例如我想在当前这个插件目录下新增一个模块 echo 用于回显信息，可以在hello目录下增加一个脚本文件：</p>

<div class="highlighter-rouge"><pre class="highlight"><code>    hello
     - xmake.lua
     - main.lua
     - echo.lua
</code></pre>
</div>

<p>echo.lua的内容如下：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code>    <span class="c1">-- 增加一个显示信息的接口show</span>
    <span class="k">function</span> <span class="nf">show</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>然后在main.lua里面导入这个模块就可以使用了：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code>    <span class="c1">-- 导入选项模块</span>
    <span class="n">import</span><span class="p">(</span><span class="s2">"core.project.option"</span><span class="p">)</span>

    <span class="c1">-- 导入当前插件目录下echo模块</span>
    <span class="n">import</span><span class="p">(</span><span class="s2">"echo"</span><span class="p">)</span>

    <span class="c1">-- main.lua入口函数</span>
    <span class="k">function</span> <span class="nf">main</span><span class="p">()</span>
     
        <span class="c1">-- 使用echo模块来显示</span>
        <span class="k">if</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">)</span> <span class="k">then</span>
            <span class="n">echo</span><span class="p">.</span><span class="n">show</span><span class="p">(</span><span class="s2">"version: %s"</span><span class="p">,</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">))</span>
        <span class="k">else</span>
            <span class="c1">-- 显示内容</span>
            <span class="n">echo</span><span class="p">.</span><span class="n">show</span><span class="p">(</span><span class="s2">"hello %s!"</span><span class="p">,</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"output"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"xmake"</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>怎么样，简单吧import后，就可以直接使用这个模块的所有公有接口，像show就是被导出的公有接口</p>

<p>如果一些接口是私有的不想被导出怎么办呢，只需要加上 _ 前缀就行了，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code>    <span class="c1">-- 私有接口</span>
    <span class="k">function</span> <span class="nf">_print</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="n">_g</span><span class="p">.</span><span class="n">info</span><span class="p">)</span>
    <span class="k">end</span>

    <span class="c1">-- 公有接口</span>
    <span class="k">function</span> <span class="nf">show</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
        <span class="n">_print</span><span class="p">(</span><span class="n">info</span><span class="p">)</span>
        <span class="n">_g</span><span class="p">.</span><span class="n">info</span> <span class="o">=</span> <span class="n">info</span>
    <span class="k">end</span>
</code></pre>
</div>

<p>注：其中_g是全局私有变量，用于模块内部全局私有数据的维护和传递</p>

        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        

        
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/17/xmake-update-v2.6.2/">xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2016/06/09/custom-task/">高级特性之自定义task任务</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2016/06/09/plugin-hello/">插件开发之hello xmake</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
